home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Skunkware 5
/
Skunkware 5.iso
/
man
/
cat.n
/
uplevel.n
< prev
next >
Wrap
Text File
|
1995-07-25
|
4KB
|
132 lines
uuuupppplllleeeevvvveeeellll((((nnnn)))) TTTTccccllll (((( )))) uuuupppplllleeeevvvveeeellll((((nnnn))))
_________________________________________________________________
NNNNAAAAMMMMEEEE
uplevel - Execute a script in a different stack frame
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
uuuupppplllleeeevvvveeeellll ?_l_e_v_e_l? _a_r_g ?_a_r_g ...?
_________________________________________________________________
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
All of the _a_r_g arguments are concatenated as if they had
been passed to ccccoooonnnnccccaaaatttt; the result is then evaluated in the
variable context indicated by _l_e_v_e_l. UUUUpppplllleeeevvvveeeellll returns the
result of that evaluation.
If _l_e_v_e_l is an integer then it gives a distance (up the
procedure calling stack) to move before executing the
command. If _l_e_v_e_l consists of #### followed by a number then
the number gives an absolute level number. If _l_e_v_e_l is
omitted then it defaults to 1111. _L_e_v_e_l cannot be defaulted if
the first _c_o_m_m_a_n_d argument starts with a digit or ####.
For example, suppose that procedure aaaa was invoked from top-
level, and that it called bbbb, and that bbbb called cccc. Suppose
that cccc invokes the uuuupppplllleeeevvvveeeellll command. If _l_e_v_e_l is 1111 or ####2222 or
omitted, then the command will be executed in the variable
context of bbbb. If _l_e_v_e_l is 2222 or ####1111 then the command will be
executed in the variable context of aaaa. If _l_e_v_e_l is 3333 or ####0000
then the command will be executed at top-level (only global
variables will be visible).
The uuuupppplllleeeevvvveeeellll command causes the invoking procedure to
disappear from the procedure calling stack while the command
is being executed. In the above example, suppose cccc invokes
the command
uuuupppplllleeeevvvveeeellll 1111 {{{{sssseeeetttt xxxx 44443333;;;; dddd}}}}
where dddd is another Tcl procedure. The sssseeeetttt command will
modify the variable xxxx in bbbb's context, and dddd will execute at
level 3, as if called from bbbb. If it in turn executes the
command
uuuupppplllleeeevvvveeeellll {{{{sssseeeetttt xxxx 44442222}}}}
then the sssseeeetttt command will modify the same variable xxxx in bbbb's
context: the procedure cccc does not appear to be on the call
stack when dddd is executing. The command ``iiiinnnnffffoooo lllleeeevvvveeeellll'' may
be used to obtain the level of the current procedure.
UUUUpppplllleeeevvvveeeellll makes it possible to implement new control
constructs as Tcl procedures (for example, uuuupppplllleeeevvvveeeellll could be
Page 1 (printed 7/17/95)
uuuupppplllleeeevvvveeeellll((((nnnn)))) TTTTccccllll (((( )))) uuuupppplllleeeevvvveeeellll((((nnnn))))
used to implement the wwwwhhhhiiiilllleeee construct as a Tcl procedure).
KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
context, stack frame, variables
Page 2 (printed 7/17/95)